package com.gis.bigdata.spark.core.test

import java.io.{InputStream, ObjectInputStream}
import java.net.{ServerSocket, Socket}


/**
 * @author LnnuUser
 * @create 2021-08-25-下午8:34
 */
object Executor {

  def main(args: Array[String]): Unit = {

    //启动服务器，接受数据
    val server = new ServerSocket( 9999)
    println("服务器启动，等待接收数据")

    //等待客户端的连接
    val client: Socket = server.accept()
    val in: InputStream = client.getInputStream
    val objIn: ObjectInputStream = new ObjectInputStream(in)
    val task: Task = objIn.readObject().asInstanceOf[Task]
    val ints: List[Int] = task.compute()

//    val i: Int = in.read()
    println("接收到的数据：" + ints)

    objIn.close()
    client.close()
    server.close()
  }

}
